package gui.commons;

public class CopUtils {
	
	/*
	 * method to get file extensions and filter those in the JFileChoosers
	 * */
	public static String getFileExtension(String fname) {
		/*
		 * getFileExtension variables; point index and length
		 * */
		int pt, len;
		
		pt = fname.lastIndexOf(".");
		len = fname.length();
		
		// When the operation doesn't find a point
		if(pt == -1) return null;
		// When the point is the last file's character. Thus, it doesn't have an extension, basically
		if(pt == len-1) return null;	
		// else, return the extension which is the text after the point index
		return fname.substring(pt+1, len);
	}
}